home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / VerticalSliderBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  4KB  |  131 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  07/17/97    LAB    Moved connection for setTickStyle property back into base class,
  8. //                    since that's where it is now.
  9. //  09/07/97    LAB    Fixed misspelling of descriptions.
  10. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  11.  
  12. /**
  13.  * BeanInfo for VerticalSlider.
  14.  *
  15.  */
  16. public class VerticalSliderBeanInfo extends SimpleBeanInfo {
  17.  
  18.     /**
  19.      * Constructs a VerticalSliderBeanInfo object.
  20.      */
  21.     public VerticalSliderBeanInfo() {
  22.     }
  23.  
  24.     /**
  25.      * Gets a BeanInfo for the superclass of this bean.
  26.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  27.      */
  28.     public BeanInfo[] getAdditionalBeanInfo() {
  29.         try {
  30.             BeanInfo[] bi = new BeanInfo[1];
  31.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  32.             return bi;
  33.         }
  34.         catch (IntrospectionException e) { throw new Error(e.toString());}
  35.     }
  36.  
  37.     /**
  38.      * Gets the SymantecBeanDescriptor for this bean.
  39.      * @return an object of type SymantecBeanDescriptor
  40.      * @see symantec.itools.beans.SymantecBeanDescriptor
  41.      */
  42.     public BeanDescriptor getBeanDescriptor() {
  43.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  44.         String s=group.getString("GroupAWTAdditions"); 
  45.  
  46.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  47.         bd.setFolder(s);
  48.         bd.setWinHelp("0x123AB");
  49.  
  50.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  51.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  52.                                                 "%name%.TICK_LEFT",
  53.                                                 conn.getString("TICK_LEFT")));
  54.  
  55.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  56.                                                 "%name%.TICK_RIGHT",
  57.                                                 conn.getString("TICK_RIGHT")));
  58.  
  59.         bd.addAdditionalConnections(getAdditionalBeanInfo());
  60.  
  61.         return (BeanDescriptor) bd;
  62.     }
  63.  
  64.     /**
  65.      * Gets an image that may be used to visually represent this bean
  66.      * (in the toolbar, on a form, etc).
  67.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  68.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  69.      * @return an image for this bean, always color even if requested monochrome
  70.      * @see BeanInfo#ICON_MONO_16x16
  71.      * @see BeanInfo#ICON_COLOR_16x16
  72.      * @see BeanInfo#ICON_MONO_32x32
  73.      * @see BeanInfo#ICON_COLOR_32x32
  74.      */
  75.     public java.awt.Image getIcon(int iconKind) {
  76.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  77.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  78.             java.awt.Image img = loadImage("VerticalSliderC16.gif");
  79.             return img;
  80.         }
  81.  
  82.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  83.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  84.             java.awt.Image img = loadImage("VerticalSliderC32.gif");
  85.             return img;
  86.         }
  87.  
  88.         return null;
  89.     }
  90.  
  91.     /**
  92.      * Gets an array of descriptions of the methods used for "connections" by
  93.      * Visual CafΘ's Interaction Wizard.
  94.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  95.      * @return method descriptions for this bean
  96.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  97.      */
  98.     public MethodDescriptor[] getMethodDescriptors() {
  99.         Class[] args;
  100.         ConnectionDescriptor connection;
  101.         java.util.Vector connections;
  102.         java.util.Vector md = new java.util.Vector();
  103.  
  104.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  105.         md.copyInto(rv);
  106.  
  107.         return rv;
  108.     }
  109.  
  110.     /**
  111.      * Returns descriptions of this bean's properties.
  112.      */
  113.     public PropertyDescriptor[] getPropertyDescriptors() {
  114.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  115.  
  116.         try{
  117.         PropertyDescriptor tickStyle = new PropertyDescriptor("tickStyle", beanClass);
  118.         tickStyle.setBound(true);
  119.         tickStyle.setConstrained(true);
  120.         tickStyle.setDisplayName(prop.getString("tickStyle"));
  121.         tickStyle.setValue("ENUMERATION", "TICK_BOTTOM=0, TICK_TOP=1, TICK_BOTH=2, TICK_NONE=3");
  122.  
  123.         PropertyDescriptor[] rv = {
  124.             tickStyle};
  125.         return rv;
  126.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  127.     }
  128.  
  129.     private final static Class beanClass = VerticalSlider.class;
  130.  
  131.     }    //  end of class VerticalSliderBeanInfo